Repository navigation
fix(muse-proxy): exec fallback turn deadline + kill escalation (#2159) - #4242
Conversation
|
Warning Review limit reachedYou've used all free OSS reviews for now. Wait for the free limit to reset to keep reviewing this public repository. Next included review available in 50 minutes. View limit details
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. |
Codex Review SummaryThis comment shows the latest Codex review activity on this pull request.
ℹ️ About Codex in GitHubYour team has set up Codex to review pull requests in this repo. Reviews are triggered when you
Codex reacts with 👀 while any review is running, comments if it has suggestions, and reacts with 👍 once all reviews finish with no findings. |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 500edffb06
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
|
Worker note (task 5196, lane E): Codex P2 finding is valid and will be fixed on resume — |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 71c424214c
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
…d close (#2159) Codex P2 on PR #4242: a descendant inheriting the child's stdio pipes delays Node's child close event indefinitely, so a timed-out request never settled and its prompt file was never unlinked. The close handler is now a settle-once settleRequest; the deadline arms an independent settle just past the kill grace (SIGKILL path still settles via close first) that destroys the pipes, settles with the timeout failure, and runs prompt-file cleanup. Regression test: stub child spawns an inheriting-pipe descendant — the request settles at deadline+grace+1s with the child dead and the prompt file removed. node --test bin/muse-proxy.test.mjs: 36/36 pass on the laptop.
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: 890c547ba5
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if (settled) return; | ||
| settled = true; | ||
| clearTimeout(deadlineTimer); | ||
| if (settleTimer) clearTimeout(settleTimer); |
There was a problem hiding this comment.
Settle streaming responses when spawning the child fails
For streaming requests, an asynchronous spawn failure such as ENOENT or EACCES now leaves the HTTP request pending indefinitely. The SSE headers have already been set, so the existing !res.headersSent branch does not end the response; setting settled = true also prevents the subsequent close handler from emitting the SSE error, and clearing the deadline removes the remaining settlement path. I reproduced this with an executable whose interpreter is missing: the parent commit returns an SSE error plus [DONE], whereas this commit hangs past the configured deadline. Route this error through emitFailure for streaming responses before marking settlement complete.
Useful? React with 👍 / 👎.
Fixes #2159 (queue task 5196; contract pinned by triage task 3184).
What
The exec fallback settled a request only when its
muse execchild closed, with no turn deadline — a hung child wedged the request forever and leaked the process; the only kill was a bare SIGTERM on client disconnect.EXEC_TURN_TIMEOUT_MS = 300_000with a strictMUSE_PROXY_EXEC_TURN_TIMEOUT_MSoverride: positive-integer parse, invalid values warn once and fall back to the default (0/disabled is not expressible).killChildWithEscalationhelper: SIGTERM, then SIGKILL after a 3000ms unref’d grace; idempotent (flag + exit check) so the deadline and disconnect paths race safely. Theres.on(close)disconnect handler now uses it instead of the bare SIGTERM.timedOutflag checked FIRST in the close handler forces the existing error shape (muse exec turn timed out after <ms>ms, SSE-framed + [DONE] for streaming per muse-proxy: streaming execution failure is sent as unframed JSON on a 200 SSE response — clients see an empty successful stream #670, 500 JSON otherwise), skipping muse-proxy (PR #479): streaming responses silently drop the terminal text tail that non-streaming returns #484 reconciliation and overriding any completed terminal state. Prompt file is unlinked on the deadline path through the existing close handler. muse-proxy (PR #479): streaming responses silently drop the terminal text tail that non-streaming returns #484/muse-proxy: a run that fails after producing partial output is reported as a successful 'stop' — failure is masked whenever any content exists #672 semantics for self-exiting children are preserved (the failure emitter was extracted verbatim intoemitFailure).Tests
node --test bin/muse-proxy.test.mjs— 40/40 pass, including 6 new #2159 tests with stub children: never-exiting child killed at a 300ms deadline (500 + timeout message + prompt file gone); streaming gets the SSE-framed error + [DONE]; SIGTERM-ignoring child SIGKILLed after the grace; completed-then-hangs child reported as a timeout failure, not a stop; a normal child inside the deadline is unaffected; client disconnect kills the child via the shared helper.Need help on this PR? Tag
@codesmith-botwith what you need.